package deepclone.serialize;


/**
 * @author wangLin
 * @version 1.0
 * @projectName singletonPattern20210416
 * @className Client
 * @date 2021-04-16 周五
 * @time 8:57
 * @description TODO
 */


public class Client {
    public static void main(String[] args) {
        WeeklyLog log_previous, log_new = null;

//        创建原型对象
        log_previous = new WeeklyLog();

//        创建附件对象
        Attachment attachment = new Attachment();

//        将附件添加到周报中
        log_previous.setAttachment(attachment);

        try {
            //调用深克隆方法创建克隆兑现
            log_new = log_previous.deepClone();
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("克隆失败！！！");
        }
        //比较周报是否相同
        System.out.println("周报是否相同？" + (log_previous == log_new));

//        比较附件是否相同
        System.out.println("附件是否相同？" + (log_previous.getAttachment() == log_new.getAttachment()));

    }
}
